﻿using System;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using YArchitech.Controls;
using YJKBatchPrinter.Layout;

namespace YJKBatchPrinter.Commands
{
	[Transaction(TransactionMode.Manual)]
	[Regeneration(RegenerationOption.Manual)]
	public class CmdAddPictureFrame : IExternalCommand
	{
		public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elems)
		{
			Document document = cmdData.Application.ActiveUIDocument.Document;
            Autodesk.Revit.DB.View activeView = document.ActiveView;
            if ((int)activeView.ViewType != 6 && (int)activeView.ViewType != 115)
			{
				YJKMessageBox.Show("请切换到图纸视图下运行此命令！");
				return Autodesk.Revit.UI.Result.Cancelled;
			}
			AddPictureFrame addPictureFrame = new AddPictureFrame(cmdData);
			addPictureFrame.ShowDialog();
			return Autodesk.Revit.UI.Result.Succeeded;
		}
	}
}
